public class Test27 {
    public int lengthOfLIS(int[] nums) {
        int n = nums.length;
        int[] dp = new int[n];
        dp[0] = 1;
        int ret = 1;
        for(int i = 1;i < n;i++) {
            for(int j = i - 1;j >= 0;j--) {
                if(nums[i] > nums[j]) {
                    dp[i] = Math.max(dp[i],dp[j]);
                }
            }
            dp[i] += 1;
            ret = Math.max(ret,dp[i]);
        }
        return ret;
    }
}
